      PROGRAM HBREAD
      
      IMPLICIT NONE

      INTEGER NWPAWC,IPAW,IQUEST
      
      PARAMETER (NWPAWC = 20000000)
      COMMON/PAWC/IPAW(NWPAWC)   
      COMMON/QUEST/IQUEST(100)

      CHARACTER*256 CHF(4000)
      
      INTEGER ISTAT,NFILE,IFILE,NFREAD,FILE,ITASK,K
      CHARACTER*100 NtFileName
      
      REAL*4 TimeStart,TimeEnd
      
      IQUEST(10) = 65000
      
      CALL TIMEX(TimeStart)
      CALL HLIMIT(NWPAWC)


ccc--------------------------------------------------------------------



c      NFREAD = 3473
      NFREAD = 2098  ! for v13 generated by Deb at PNNL 

      NFREAD = 1906 ! v2 for pipipi0 - missing a few files
      NFREAD = 1887 ! no exp43

      NFREAD = 2055 ! for v14 generated by asner at PNNL, also v15 with eg cut at 50 mev
c      NFREAD = 21

c      NFREAD = 166

      NFREAD = 1519 ! for on 5 datasets

      NFREAD = 2004 ! for exp61 and 73 too

c      NFREAD = 20

      NFREAD = 10 ! for testing

      IFILE  = 0

      K=1

c      CHF(K)="mc/1p1s.hbook";K=K+1
c      CHF(K)="mc/2p1s.hbook";K=K+1
c      CHF(K)="mc/2p2s.hbook";K=K+1

c v14 with no prob2pi cut
c        CHF(K)="v16-exp43/y5sg-v22-exp43-hbjscan5s-0.hbook";K=K+1

      CHF(K)="e000043r001002.hbook";K=K+1
      CHF(K)="e000043r001003.hbook";K=K+1
      CHF(K)="e000043r001005.hbook";K=K+1
      CHF(K)="e000043r001006.hbook";K=K+1
      CHF(K)="e000043r001007.hbook";K=K+1
      CHF(K)="e000043r001009.hbook";K=K+1
      CHF(K)="e000043r001012.hbook";K=K+1
      CHF(K)="e000043r001013.hbook";K=K+1
      CHF(K)="e000043r001014.hbook";K=K+1
      CHF(K)="e000043r001016.hbook";K=K+1


 97     continue



ccc--------------------------------------------------------------------
      
      NFILE=NFREAD
      FILE=0
      
 100  IFILE=IFILE+1

      NtFileName=CHF(IFILE)
      
C...  Open the file

      CALL HROPEN(70,'FILE',NtFileName,' ',32768,ISTAT)      
      PRINT *,'openning ',NtFileName, IFILE, NFILE
      IF (ISTAT.NE.0) THEN
         PRINT *,'Stop, cannot open ',NtFileName
         STOP
      ENDIF
      
      CALL HCDIR(' ',' ')

      CALL HRIN(3,99999999,0)

      CALL HB(IFILE,CHF)

      CALL HREND('FILE')

      CLOSE(0)

      IF(IFILE.LT.NFILE) GO TO 100  

      CALL HRPUT(0,'gtntp.hbook',' ')

ccc---------------------------------------------------------

 999  CONTINUE

      CALL TIMEX(TimeEnd)
      
      PRINT *,'Time used ',TimeEnd - TimeStart,' s'
      
      END
      
